﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PowerShell.Host.PsTFS.CdmLet.PsObject
{
    public class PsLog
    {
        public static bool bLog { get; set; }
        public DateTime Date { get; set; }
        public String Owner { get; set; }
        public String msg { get; set; }
        public EventArgs e { get; set; }

        private static List<PsLog> Log = new List<PsLog>();


        public static void AddLog(EventArgs e, string msg)
        {
            if (bLog)
            {
                PsLog l = new PsLog();
                l.Date = DateTime.Now;
                l.e = e;
                l.msg = msg;
                l.Owner = PsService.User;
                Log.Add(l);
            }
        }

        public static List<PsLog> GetLog()
        {
            return Log;
        }


        internal static void AddLog(string msg)
        {
            if (bLog)
            {
                PsLog l = new PsLog();
                l.Date = DateTime.Now;
                l.e = null;
                l.msg = msg;
                l.Owner = PsService.User;
                Log.Add(l);
            }
        }
    }
}
